<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="saveBtn">save</button>
    <script>
        const saveBtn = document.getElementById('saveBtn');
        // 1. 自定义事件对象e1, on<事件名> -> onclick
        const e1 = new Event('click');

        // 2. 绑定事件
        saveBtn.addEventListener('click', (e) => {
            console.log('hello click', e);
        });
        // 3. 触发事件
        saveBtn.dispatchEvent(e1);

    </script>

</body>

</html>